import 'package:flutter/material.dart';

class TabControllerPage extends StatefulWidget {
  // TabControllerPage({Key? key}) : super(key: key);

  @override
  _TabControllerPageState createState() => _TabControllerPageState();
}

class _TabControllerPageState extends State<TabControllerPage>
    with SingleTickerProviderStateMixin {
  var _tabController;

  @override
  void initState() {
    super.initState();
    _tabController = new TabController(
      vsync: this,
      length: 2,
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("TabControllerPage"),
        bottom: TabBar(
          controller: this._tabController,
          tabs: [
            Tab(
              text: "one",
            ),
            Tab(
              text: "two",
            ),
          ],
        ),
      ),
      body: TabBarView(
        controller: this._tabController,
        children: [
          ListView(
            children: [
              ListTile(
                title: Text("one"),
              ),
              ListTile(
                title: Text("one"),
              ),
            ],
          ),
          ListView(
            children: [
              ListTile(
                title: Text("two"),
              ),
              ListTile(
                title: Text("two"),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
